/**
 * <p>Title: SMSSystemAutoRunListener.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 张志芳
 * @version 1.0
 * <pre>Histroy:
 *          2012-7-2 上午03:34:19  张志芳  Create
 *</pre>
 */
package com.baosight.sczx.common.zm.basetools.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import com.baosight.sczx.common.zm.cInterface.ct.SystemSet;

/**
 * 监听器, 驱动定时器的开始（短信平台）
 * <p>Title: SMSSystemAutoRunListener.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 张志芳
 * @version 1.0
 * <pre>Histroy:
 *          2012-7-2 上午03:34:19  张志芳  Create
 *</pre>
 */
public class SMSSystemAutoRunListener implements ServletContextListener {
	private java.util.Timer timer = null;
	
	public void contextDestroyed(ServletContextEvent arg0) {
		// TODO Auto-generated method stub
		timer.cancel();
	}

	public void contextInitialized(ServletContextEvent arg0) {
		// TODO Auto-generated method stub
		timer = new java.util.Timer(true);
		timer.scheduleAtFixedRate(new SMSSystemAutoRun(arg0.getServletContext()),0, (long) Long.parseLong(SystemSet.getInstance().getFdSystemFrequency()) * 60 * 1000);
	}

}
